package bioinfo;

import java.util.Vector;

public class ARN {
    private String categ;
    private String sousCateg;
    private String nom;
    private String nomDetail;
    private int longueur;
    private String type;
    private String anticodon;
    private int position;
    private String seq;
    private String str;

    public ARN() {
        this.categ = "";
        this.sousCateg = "";
        this.nom = "";
        this.nomDetail = "";
        this.longueur = 0;
        this.type = "";
        this.anticodon = "";
        this.position = 0;
        this.seq = "";
        this.str = "";
    }

    public ARN(String categ, String sousCateg, String nom, String nomDetail, int longueur, String type, String anticodon, int position, String seq, String str) {
        this.categ = categ;
        this.sousCateg = sousCateg;
        this.nom = nom;
        this.nomDetail = nomDetail;
        this.longueur = longueur;
        this.type = type;
        this.anticodon = anticodon;
        this.position = position;
        this.seq = seq;
        this.str = str;
    }
    
    public static Vector<ARN> getARNByCategory(Vector<ARN> v, String categ) {
        Vector<ARN> res = new Vector<ARN>();

        for (ARN a : v) {
            if (a.getCateg().compareTo(categ) == 0)
                res.add(a);
        }

        return res;
    }

    public static Vector<ARN> getARNBySubCategory(Vector<ARN> v, String sousCateg) {
        Vector<ARN> res = new Vector<ARN>();

        for (ARN a : v) {
            if (a.getSousCateg().compareTo(sousCateg) == 0)
                res.add(a);
        }

        return res;
    }

    public String toString() {
        return "Nom : "+this.nom+"\n"+
            "Catégorie : "+this.categ+"\n"+
            "Sous-catégorie : "+this.sousCateg+"\n"+
            "Nom détaillé : "+this.nomDetail+"\n"+ 
            "Longueur : "+this.longueur+"\n"+
            "Type : "+this.type+"\n"+
            "Anticodon : "+this.anticodon+" (Position : "+this.position+")\n"+
            "Séquence : "+this.seq+"\n"+
            "Structure : "+this.str;
    }

    public String toHTMLString() {
        return "<html>"+
            this.nom+" ("+this.categ+" - "+this.sousCateg+")"+
            "<br />Nom complet : "+this.nomDetail+
            "<br />Longueur : "+this.longueur+" Type : "+this.type+" Anticodon : "+this.anticodon+" ("+this.position+")"+
            "<br />Séq. : "+this.seq+
            "<br />Struct. : "+this.str+
            "</html>";
    }

    public String getCateg() {
        return this.categ;
    }

    public void setCateg(String categ) {
        this.categ = categ;
    }

    public String getSousCateg() {
        return this.sousCateg;
    }

    public void setSousCateg(String sousCateg) {
        this.sousCateg = sousCateg;
    }

    public String getNom() {
        return this.nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }
    
    public String getNomDetail() {
        return this.nomDetail;
    }

    public void setNomDetail(String nomDetail) {
        this.nomDetail = nomDetail;
    }

    public int getLongueur() {
        return this.longueur;
    }

    public void setLongueur(int longueur) {
        this.longueur = longueur;
    }

    public String getType() {
        return this.type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getAnticodon() {
        return this.anticodon;
    }

    public void setAnticodon(String anticodon) {
        this.anticodon = anticodon;
    }

    public int getPosition() {
        return this.position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public String getSeq() {
        return this.seq;
    }

    public void setSeq(String seq) {
        this.seq = seq;
    }

    public String getStr() {
        return this.str;
    }

    public void setStr(String str) {
        this.str = str;
    }
}
